<?php 

include "../function.php";


try {
	$db = new PDO("mysql:host=127.0.0.1;dbname=school;charset=utf8","root","");

	// $sql="select name , age from stu limit 3";
	
	// $res=$db->query($sql);
	// var_dump($res->fetchALL(pdo::FETCH_ASSOC));


	// $sql="select count(*) from stu ";
	$sql="delete from stu where id>10 ";
	$sql=" insert into stu (name,sex) values('小刘','男')";
	// $sql="delete from stu where id=2446";
	$res=$db->exec($sql);
	// var_dump($res);
	if (!$res) {
		exit("错误代码:".$db->errorcode()."错误信息".$db->errorinfo()[2]);
	}
	var_dump($res);

} catch (Exception $e) {
	echo "Error:".$e;
	
}













 ?>